{
  "name": "Case 12 – Patent Application Screening",
  "nodes": [
    {
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2,
      "position": [0, 0],
      "parameters": {
        "formTitle": "Patent Application Draft Submission",
        "formDescription": "Upload draft patent for preliminary patentability screening",
        "formFields": {
          "values": [
            { "fieldLabel": "Inventor Name", "requiredField": true },
            { "fieldLabel": "Email id", "fieldType": "email", "requiredField": true },
            {
              "fieldLabel": "Patent_Draft",
              "fieldType": "file",
              "acceptFileTypes": ".pdf",
              "requiredField": true
            }
          ]
        }
      }
    },
    {
      "name": "Upload file",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [220, 0],
      "parameters": {
        "inputDataFieldName": "Patent_Draft",
        "name": "={{ $json['Inventor Name'] + '_Patent_Draft' }}",
        "folderId": "REPLACE_WITH_PATENT_DRAFTS_FOLDER_ID"
      }
    },
    {
      "name": "Download file",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [420, 0],
      "parameters": {
        "operation": "download",
        "fileId": "={{ $json.id }}"
      }
    },
    {
      "name": "Extract Patent Draft",
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [620, 0],
      "parameters": {
        "operation": "pdf"
      }
    },
    {
      "name": "Download Patentability Rules & Prior Art Guidance",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [820, 0],
      "parameters": {
        "operation": "download",
        "fileId": "REPLACE_WITH_PATENT_RULES_FILE_ID"
      }
    },
    {
      "name": "Extract Patent Rules",
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [1020, 0],
      "parameters": {
        "operation": "pdf"
      }
    },
    {
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3,
      "position": [220, 260],
      "parameters": {
        "promptType": "define",
        "text": "=Draft Patent Application:\n{{ $('Extract Patent Draft').item.json.text }}\n\nPatentability Rules & Prior Art Guidelines:\n{{ $('Extract Patent Rules').item.json.text }}",
        "options": {
          "systemMessage": "You are a Patent Attorney conducting an initial patentability screening.\n\nYOUR OBJECTIVE:\nAssess whether a draft patent application should be filed as-is or requires claim revision, based on novelty, inventive step, and defensibility against prior art.\n\nANALYSIS FRAMEWORK (MANDATORY):\n1. SUBJECT MATTER ELIGIBILITY – assess whether claims fall under patent-eligible subject matter.\n2. NOVELTY – evaluate whether claimed elements appear new relative to known prior art.\n3. INVENTIVE STEP (NON-OBVIOUSNESS) – assess whether the invention is a non-trivial advancement.\n4. CLAIM CLARITY & SCOPE – assess precision, breadth, and support in the specification.\n5. DEFENSIBILITY – likelihood of surviving examination and post-grant challenges.\n\nYOU MUST PRODUCE ONE JSON OBJECT WITH EXACTLY THESE FIELDS. ALL FIELDS ARE MANDATORY.\n\nJSON SCHEMA (STRICT):\n{\n  \"Invention_Title\": \"string\",\n  \"Inventor_Name\": \"string\",\n  \"Technical_Field\": \"string\",\n  \"Claim_Breadth_Assessment\": \"Narrow | Moderate | Broad\",\n  \"Novelty_Assessment\": \"Low | Medium | High\",\n  \"Inventive_Step_Assessment\": \"Weak | Moderate | Strong\",\n  \"Prior_Art_Risk\": \"Low | Medium | High\",\n  \"Defensibility_Assessment\": \"Low | Medium | High\",\n  \"Overall_Patentability_Score_out_of_100\": \"number\",\n  \"Filing_Recommendation\": \"File Patent | Revise Claims\",\n  \"Key_Attorney_Comments\": \"string\"\n}\n\nINSTRUCTIONS:\n- Numeric fields MUST contain numbers only.\n- Do NOT add, remove, or rename fields.\n- Output ONLY valid JSON.\n- IMMEDIATELY call the Google Sheets Append Row tool using this JSON."
        }
      }
    },
    {
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [0, 420],
      "parameters": {
        "model": {
          "mode": "list",
          "value": "gpt-4.1-mini"
        }
      }
    },
    {
      "name": "Append row",
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4,
      "position": [420, 460],
      "parameters": {
        "operation": "append",
        "documentId": "REPLACE_WITH_GOOGLE_SHEET_ID",
        "sheetName": "Patent Application Screening Register"
      }
    },
    {
      "name": "Send Email",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2,
      "position": [420, 260],
      "parameters": {
        "sendTo": "={{ $('On form submission').item.json['Email id'] }}",
        "subject": "Patent Application Screening – Recommendation",
        "message": "={{ 'Dear ' + $('On form submission').item.json['Inventor Name'] + ',<br><br>Your draft patent application has been reviewed for patentability. Based on our preliminary assessment, we will advise you on filing or claim revisions shortly.<br><br>Patent Review Team' }}"
      }
    }
  ],
  "connections": {
    "On form submission": { "main": [[{ "node": "Upload file" }]] },
    "Upload file": { "main": [[{ "node": "Download file" }]] },
    "Download file": { "main": [[{ "node": "Extract Patent Draft" }]] },
    "Extract Patent Draft": { "main": [[{ "node": "Download Patentability Rules & Prior Art Guidance" }]] },
    "Download Patentability Rules & Prior Art Guidance": { "main": [[{ "node": "Extract Patent Rules" }]] },
    "Extract Patent Rules": { "main": [[{ "node": "AI Agent" }]] },
    "OpenAI Chat Model": { "ai_languageModel": [[{ "node": "AI Agent" }]] },
    "Append row": { "ai_tool": [[{ "node": "AI Agent" }]] },
    "AI Agent": { "main": [[{ "node": "Send Email" }]] }
  },
  "active": false
}
